// http://116.62.180.183:28081/pp/biz01/api/Biz01QryBroadbandOrder?clientName=&clientPhone=&pageNo=1&pageSize=10&take=10&skip=0&page=1
import { OrderInfo, OrderListPageParams } from '@/types/order/order'
import request from '@/utils/request'
import type { BaseResonse, PageResult } from '@/types/global';

// 获取订单列表(分页)
export const broadbandOrderApi = (params: OrderListPageParams) => {
    return new Promise<BaseResonse<PageResult<OrderInfo>>>((resolve) => {
        // 模拟数据
        const mockData: OrderInfo[] = [
            {
                clientAddr: '北京市海淀区',
                clientIdCard: '110101199001011234',
                clientIdCardEnc: 'encrypted_id_1',
                clientName: '张三',
                clientPackage: '家庭套餐',
                clientPhone: '13800138000',
                clientPhoneEnc: 'encrypted_phone_1',
                createTime: '2024-01-01 10:00:00',
                creatorAccount: 'admin',
                delFlag: 0,
                id: 1,
                orderId: 1001,
                orderStatus: 1,
                paymentStatus: 0,
                remark: '备注信息1',
                responsibleAccount: 'lisi',
                responsibleServiceProvider: '服务商A',
                serialVersionUID: 1,
                updateTime: '2024-01-01 10:00:00',
            },
            {
                clientAddr: '上海市浦东新区',
                clientIdCard: '310101199202024567',
                clientIdCardEnc: 'encrypted_id_2',
                clientName: '李四',
                clientPackage: '商务套餐',
                clientPhone: '13911112222',
                clientPhoneEnc: 'encrypted_phone_2',
                createTime: '2024-01-02 11:00:00',
                creatorAccount: 'admin',
                delFlag: 0,
                id: 2,
                orderId: 1002,
                orderStatus: 2,
                paymentStatus: 1,
                remark: '备注信息2',
                responsibleAccount: 'wangwu',
                responsibleServiceProvider: '服务商B',
                serialVersionUID: 2,
                updateTime: '2024-01-02 11:00:00',
            },
            {
                clientAddr: '深圳市南山区',
                clientIdCard: '440305199503037890',
                clientIdCardEnc: 'encrypted_id_3',
                clientName: '王五',
                clientPackage: '企业套餐',
                clientPhone: '13722223333',
                clientPhoneEnc: 'encrypted_phone_3',
                createTime: '2024-01-03 12:00:00',
                creatorAccount: 'admin',
                delFlag: 0,
                id: 3,
                orderId: 1003,
                orderStatus: 0,
                paymentStatus: 0,
                remark: '备注信息3',
                responsibleAccount: 'zhaoliu',
                responsibleServiceProvider: '服务商C',
                serialVersionUID: 3,
                updateTime: '2024-01-03 12:00:00',
            },
        ];

        // 模拟延时
        setTimeout(() => {
            const data: PageResult<OrderInfo> = {
                records: mockData,
                totalCount: 11
            }
            const res: BaseResonse<PageResult<OrderInfo>> = {
                code: 0,
                message: 'success',
                data: data,
            }
            resolve(res);
        }, 500); // 模拟 500ms 的延迟
    });
}
export const broadbandOrderApi1 = (params: OrderListPageParams) => {
    // 发送一个get请求，获取宽带订单数据
    return request<OrderInfo[]>({
        url: '/pp/biz01/api/Biz01QryBroadbandOrder',
        method: 'get',
        params
    })
}


// 获取宽带订单详情
export const getOrderDetail = (id: number) => {
    const params = {
        pageNo: 1,
        pageSize: 10,
        take: 10,
        skip: 0,
        page: 1,
        id
    }
    return request<any[]>({
        url: '/pp/biz01/api/Biz01Login',
        method: 'get',
        params
    })
}